package com.heima.admin.controllerV1;

import com.heima.admin.service.AdChannelService;
import com.heima.model.common.admin.AdChannel;
import com.heima.model.common.dtos.ChannelDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/channel")
public class AdChannelController {

    @Autowired
    private AdChannelService adChannelService;
    @PostMapping("/list")
    public ResponseResult fingByPage( @RequestBody ChannelDto dto) {

        return adChannelService.fingByPage(dto);
    }
    @PostMapping("/save")
    public ResponseResult save(@RequestBody AdChannel adChannel) {

        return adChannelService.insert(adChannel);
    }

    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdChannel adChannel) {
        return adChannelService.update(adChannel);
    }

    @GetMapping("/del/{id}")
    public ResponseResult delete(@PathVariable("id") Integer id) {
        return adChannelService.delete(id);
    }
}
